package com.cskaoyan.javase.io._2char._4buffer;

import java.io.*;

/**
 * 自带缓冲区提高效率的字符流,都有各自一个独有成员方法
 * BufferedReader,缓冲字符输入流,readLine(),可以直接读一行数据,并且将文件指针移到下一行
 * BufferedWriter,缓冲字符输出流,newLine(),可以直接换行,开始写下一行
 *
 * @since 15:09
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo3 {
    public static void main(String[] args) throws IOException {
        /*BufferedWriter out = new BufferedWriter(new FileWriter("c.txt", true));
        out.write("我一般早上12点起床!");
        out.newLine();
        out.write("然后一点吃午饭");
        out.newLine();
        out.write("回到家开始玩游戏,玩到凌晨4点!");
        // flush
        out.flush();
        out.close();*/
        BufferedReader in = new BufferedReader(new FileReader("c.txt"));
        System.out.println(in.readLine());
        System.out.println(in.readLine());
        System.out.println(in.readLine());
        System.out.println(in.readLine());
        // close
        in.close();
    }
}
